package com.xhwl.logistics.converter;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xhwl.logistics.vo.PageVO;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class ToPageVO {

    public <P extends IPage<?>, T> PageVO<T> toPageVO(P p, List<T> list) {
        PageVO<T> pageVO = new PageVO<>();
        pageVO.setCurrent(p.getCurrent());
        pageVO.setPages(p.getPages());
        pageVO.setSize(p.getSize());
        pageVO.setTotal(p.getTotal());
        pageVO.setRecords(list);

        return pageVO;
    }

}
